const Router = require('koa-router')
const {
  getUserinfo,
  rename,
  edit,
  getAvatar
} = require('../controller/userinfo.controller')
const { verifyAuth, verifyPermission } = require('../middleware/auth.middleware')

const userinfoRouter = new Router({prefix: '/userinfo'})

// 获取用户信息
userinfoRouter.get('/:userId', getUserinfo)
// 修改用户昵称
userinfoRouter.post('/rename/:userinfoId', verifyAuth, verifyPermission, rename)
// 修改用户信息
userinfoRouter.post('/edit/:userinfoId', verifyAuth, verifyPermission, edit)
// 获取用户头像
userinfoRouter.get('/:userId/avatar', getAvatar)
module.exports = userinfoRouter